bashrc if: Expression Syntax error

解决Linux下.bash_profile语法错误
本文介绍在Linux管理中遇到的.bash_profile文件修改后的语法错误问题,特别是当shell类型不是bash而是csh时的解决方法。通过检查shell类型并将其更改为bash,可以避免source命令执行时出现的错误。

在 Linux 管理中,常有需要修改根目录下 ~/.bash_profile 文件,更改环境变量的情况,在修改好 .bash_profile 文件后,通过命令: source ~/.bash_profile 就可以直接让环境变量的修改生效了。

但是在执行时出现bashrc if: Expression Syntax error。
在这里插入图片描述
解决方法如下:

(1)使用 echo $SHELL 检查shell类型是否为bash,发现并不是bash,而是 csh。
在这里插入图片描述
(2)通过bash命令修改shell 类型为bash,source通过。
在这里插入图片描述

************************************************************ ** Visual Studio 2022 Developer Command Prompt v17.14.16 ** Copyright (c) 2025 Microsoft Corporation ********************************************************************** C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools>pip install pyltp -i https://mirrors.aliyun.com/pypi/simple/ Looking in indexes: https://mirrors.aliyun.com/pypi/simple/ Collecting pyltp Using cached https://mirrors.aliyun.com/pypi/packages/b4/e5/bbd5366ed9ac0f7f33898c0d2e2daf01d2bf2a31b6c8467d8d161b1724c3/pyltp-0.4.0.tar.gz (4.3 MB) Installing build dependencies ... done Getting requirements to build wheel ... done Preparing metadata (pyproject.toml) ... done Building wheels for collected packages: pyltp Building wheel for pyltp (pyproject.toml) ... error error: subprocess-exited-with-error × Building wheel for pyltp (pyproject.toml) did not run successfully. │ exit code: 1 ╰─> [90 lines of output] C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\dist.py:759: SetuptoolsDeprecationWarning: License classifiers are deprecated. !! ******************************************************************************** Please consider removing the following classifiers in favor of a SPDX license expression: License :: OSI Approved :: MIT License See https://packaging.python.org/en/latest/guides/writing-pyproject-toml/#license for details. ******************************************************************************** !! self._finalize_license_expression() running bdist_wheel running build running build_ext -- Building for: NMake Makefiles CMake Error at CMakeLists.txt:1 (cmake_minimum_required): Compatibility with CMake < 3.5 has been removed from CMake. Update the VERSION argument <min> value. Or, use the <min>...<max> syntax to tell CMake that the project requires at least <min> but has been updated to work with policies introduced by <max> or earlier. Or, add -DCMAKE_POLICY_VERSION_MINIMUM=3.5 to try configuring anyway. -- Configuring incomplete, errors occurred! Traceback (most recent call last): File "D:\anaconda3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module> main() File "D:\anaconda3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 335, in main json_out['return_val'] = hook(**hook_input['kwargs']) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "D:\anaconda3\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 251, in build_wheel return _build_backend().build_wheel(wheel_directory, config_settings, ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\build_meta.py", line 435, in build_wheel return _build(['bdist_wheel', '--dist-info-dir', str(metadata_directory)]) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\build_meta.py", line 423, in _build return self._build_with_temp_dir( ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\build_meta.py", line 404, in _build_with_temp_dir self.run_setup() File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\build_meta.py", line 317, in run_setup exec(code, locals()) File "<string>", line 119, in <module> File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\__init__.py", line 115, in setup return distutils.core.setup(**attrs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 186, in setup return run_commands(dist) ^^^^^^^^^^^^^^^^^^ File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\core.py", line 202, in run_commands dist.run_commands() File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1002, in run_commands self.run_command(cmd) File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\command\bdist_wheel.py", line 370, in run self.run_command("build") File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command self.distribution.run_command(command) File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\command\build.py", line 135, in run self.run_command(cmd_name) File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\cmd.py", line 357, in run_command self.distribution.run_command(command) File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\dist.py", line 1102, in run_command super().run_command(command) File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\dist.py", line 1021, in run_command cmd_obj.run() File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\command\build_ext.py", line 96, in run _build_ext.run(self) File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 368, in run self.build_extensions() File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 484, in build_extensions self._build_extensions_serial() File "C:\Users\HUAWEI\AppData\Local\Temp\pip-build-env-zr65lsz8\overlay\Lib\site-packages\setuptools\_distutils\command\build_ext.py", line 510, in _build_extensions_serial self.build_extension(ext) File "<string>", line 115, in build_extension File "D:\anaconda3\Lib\subprocess.py", line 413, in check_call raise CalledProcessError(retcode, cmd) subprocess.CalledProcessError: Command '['cmake', 'C:\\Users\\HUAWEI\\AppData\\Local\\Temp\\pip-install-whjg4my0\\pyltp_270c7727ec17430688424257cdf6262d', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=C:\\Users\\HUAWEI\\AppData\\Local\\Temp\\pip-install-whjg4my0\\pyltp_270c7727ec17430688424257cdf6262d\\build\\lib.win32-cpython-311\\', '-DPYTHON_EXECUTABLE=D:\\anaconda3\\python.exe', '-DCMAKE_BUILD_TYPE=Release', '-DEXAMPLE_VERSION_INFO=0.4.0', '-A', 'Win32', '-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_RELEASE=C:\\Users\\HUAWEI\\AppData\\Local\\Temp\\pip-install-whjg4my0\\pyltp_270c7727ec17430688424257cdf6262d\\build\\lib.win32-cpython-311\\']' returned non-zero exit status 1. [end of output] note: This error originates from a subprocess, and is likely not a problem with pip. ERROR: Failed building wheel for pyltp Failed to build pyltp ERROR: Could not build wheels for pyltp, which is required to install pyproject.toml-based projects
10-15
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值