简体   繁体   中英

OpenStack CLI Windows 10 "source" and "venv\Scripts\activate" says not recognized as an internal or external command, operable program or batch file

I am a beginner trying to use OpenStack CLI on my Windows 10 System. I have tried Python 2.7.18 and 3.9.5. I am able to install the OpenStack client via pip install python-openstackclient but when I try to use my openrc.sh file as a source I get the following "'source' is not recognized as an internal or external command, operable program or batch file." Also do I need to install venv or virtualenv separately? Any help would be appreciated thank you!

Seems there is no equivalent command to source on Windows system. Anyways, I found this article might help you, I just copied its main content here.

Reference: Ukcloud - How to use the OpenStackClient on Microsoft operating systems

Try this way to use your openrc file:

  1. Log in to OpenStack Horizon dashboard
  2. Select Access & Security from Compute menu, and then select the API Access tab (or just select API Access tab under Project menu for some versions)
  3. Download OpenStack RC File
  4. Download Source-OpenRC.ps1 and unblock it
  5. Start PowerShell and run %yourpath%\Source-OpenRC.ps1 %yourpath%\project-openrc.sh
  6. When prompted, enter your OpenStack project password
  1. Open powershell, and run:

     [System.Environment]::SetEnvironmentVariable('OS_AUTH_URL', 'https://api.pub1.infomaniak.cloud/identity/v3', [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable('OS_PROJECT_NAME', 'PROJECT NAME', [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable('OS_PROJECT_DOMAIN_NAME', 'default', [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable('OS_USERNAME', 'USER NAME', [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable('OS_USER_DOMAIN_NAME', 'default', [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable('OS_PROJECT_ID', 'PROJECT ID', [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable('OS_IDENTITY_API_VERSION', '3', [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable('OS_INTERFACE', 'public', [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable('OS_REGION_NAME', 'region-name', [System.EnvironmentVariableTarget]::User) [System.Environment]::SetEnvironmentVariable('OS_PASSWORD', 'p@ssw0rd', [System.EnvironmentVariableTarget]::User)
  2. Open other powershell and test:

     openstack image list +--------------------------------------+----------------------------------+--------+ | ID | Name | Status | +--------------------------------------+----------------------------------+--------+ | 31341ae7-da5a-42bd-9e6f-920e4839326d | Arch Linux | active | | 53b05e83-09ec-459c-bbed-dedbdc6b233e | CentOS 7 | active | | a8ce68e0-4adc-4c4b-b668-828ec48fa546 | CentOS 8 Stream | active | | 80023419-c88c-4067-98be-2eb59a1a2295 | CentOS 9 Stream | active | | 07729158-3c5e-41f8-810f-b774a83ba566 | Debian 10.12 buster | active | | b51af3cd-f0e4-48cd-ad53-a87f2073d6b5 | Debian 11.3 bullseye | active | | 6728a1a6-cf36-4817-8fc4-c0a0c2b7be04 | Fedora Cloud OS 36 | active | | 4732f043-e29f-44bc-89f3-0662261b957f | Fedora Core OS 36 | active | | 94777ea5-2d0f-4ed5-8c87-51ada40c5a95 | FreeBSD 13.1 | active | | 01b7ce6e-5f6a-47c3-ad56-be0385698e40 | Infomaniak Rescue Image | active | | d3ddc9bc-fd80-48fe-bc2d-3bbd962f5403 | OPNsense 22.1.2_2-amd64 | active | | 236847e3-f3fa-4511-baaf-e4337110a2f0 | RancherOS 1.5.8 | active | | 42aa301c-4097-4046-ba6d-082d90d4033b | Ubuntu 18.04 LTS Bionic Beaver | active | | 107db1f7-f318-4b73-9741-bc5fd1c5a84b | Ubuntu 20.04 LTS Focal Fossa | active | | b1643b50-73b9-4668-b158-b35ae0218c49 | Ubuntu 22.04 LTS Jammy Jellyfish | active | | 72e9c1cf-9f1e-4afd-b40b-b2e293827de0 | openSUSE Leap 15.4 JeOS | active | +--------------------------------------+----------------------------------+--------+

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM